home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / standard / gamma.z / gamma
Encoding:
Text File  |  1998-10-30  |  5.7 KB  |  133 lines

  1.  
  2.  
  3.  
  4. GGGGAAAAMMMMMMMMAAAA((((3333MMMM))))                                                            GGGGAAAAMMMMMMMMAAAA((((3333MMMM))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      lgamma, gamma, lgammal, gammal - log gamma function
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<mmmmaaaatttthhhh....hhhh>>>>
  13.  
  14.      ddddoooouuuubbbblllleeee ggggaaaammmmmmmmaaaa((((ddddoooouuuubbbblllleeee xxxx))));;;;
  15.      ddddoooouuuubbbblllleeee llllggggaaaammmmmmmmaaaa((((ddddoooouuuubbbblllleeee xxxx))));;;;
  16.      lllloooonnnngggg ddddoooouuuubbbblllleeee ggggaaaammmmmmmmaaaallll((((lllloooonnnngggg ddddoooouuuubbbblllleeee xxxx))));;;;
  17.      lllloooonnnngggg ddddoooouuuubbbblllleeee llllggggaaaammmmmmmmaaaallll((((lllloooonnnngggg ddddoooouuuubbbblllleeee xxxx))));;;;
  18.  
  19.      eeeexxxxtttteeeerrrrnnnn iiiinnnntttt ssssiiiiggggnnnnggggaaaammmm;;;;
  20.      eeeexxxxtttteeeerrrrnnnn iiiinnnntttt ssssiiiiggggnnnnggggaaaammmmllll;;;;
  21.  
  22. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  23.      lgamma and gamma return ln|(GAMMA(x))|, where GAMMA is the
  24.      mathematical gamma function.
  25.  
  26.      gammal and lgammal are the long double versions of the log gamma
  27.      function.
  28.  
  29.      gamma and lgamma are identical, as are gammal and lgammal.
  30.  
  31.      The external integer signgam returns the sign of GAMMA(x), and the
  32.      external integer signgaml returns the sign of GAMMAL(x).
  33.  
  34. IIIIDDDDIIIIOOOOSSSSYYYYNNNNCCCCRRRRAAAASSSSIIIIEEEESSSS
  35.      Do nnnnooootttt use the expression signgam*exp(gamma(x)) to compute g := GAMMA(x).
  36.      Instead use a program like this (in C):
  37.           lg = gamma(x); g = signgam*exp(lg);
  38.  
  39.      Only after _g_a_m_m_a has returned can _s_i_g_n_g_a_m be correct.  Note too that
  40.      GAMMA(x) must overflow when x is large enough, and is undefined when x is
  41.      a nonpositive integer.
  42.  
  43.      Analogous rules apply to gammal and signgaml.
  44.  
  45.      The following C program fragment might be used to calculate G if the
  46.      overflow needs to be detected:
  47.            if ((y = gamma(x)) > LN_MAXDOUBLE)
  48.                    error();
  49.            y = signgam * exp(y);
  50.  
  51.      where LN_MAXDOUBLE is the least value that causes _e_x_p(3M) to overflow and
  52.      is defined in the <_v_a_l_u_e_s._h> header file.
  53.  
  54.      Only in the UNIX math library for C was the name _g_a_m_m_a ever attached to
  55.      ln G.   Elsewhere (in some FORTRAN libraries) the name GAMMA belongs to G
  56.      and the name ALGAMMA to ln G in single precision;  in double the usual
  57.      names are DGAMMA and DLGAMMA in FORTRAN.  Why should C be different?
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GGGGAAAAMMMMMMMMAAAA((((3333MMMM))))                                                            GGGGAAAAMMMMMMMMAAAA((((3333MMMM))))
  71.  
  72.  
  73.  
  74.      Archeological records suggest that C's _g_a_m_m_a originally delivered  ln(G
  75.      (x)).  Later, the program _g_a_m_m_a was changed to cope with negative
  76.      arguments in a more conventional way, but the documentation did not
  77.      reflect that change correctly.  The most recent change corrects
  78.      inaccurate values when _x is almost a negative integer.
  79.  
  80.      Some math libraries have changed the name of this function to _l_g_a_m_m_a() to
  81.      suggest its real functionality.
  82.      On SGI systems, the name _g_a_m_m_a is currently maintained as a synonym to
  83.      _l_g_a_m_m_a for compatibility.  It may disappear in a future release.
  84.  
  85. NNNNOOOOTTTTEEEESSSS
  86.      lgamma and gamma are not ANSI-C functions.  If you compile with flag
  87.      -ansi or -ansiposix, you must supply your own prototypes for these
  88.      functions or you will get incorrect results. (See the prototypes defined
  89.      in /usr/include/math.h)
  90.  
  91. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  92.      In the diagnostics below, functions in the standard math library _l_i_b_m._a,
  93.      are referred to as -_l_m versions, those in math library _l_i_b_m_x._a are
  94.      referred to as -_l_m_x versions, and those in the the BSD math library
  95.      _l_i_b_m_4_3._a are referred to as -_l_m_4_3 versions.  The -_l_m and -_l_m_x versions
  96.      always return the default Quiet NaN and set _e_r_r_n_o to EDOM when a NaN is
  97.      used as an argument.  A NaN argument usually causes the -_l_m_4_3 versions to
  98.      return the same argument.  The -_l_m_4_3 versions never set _e_r_r_n_o.  The value
  99.      of HUGE_VAL is IEEE Infinity.
  100.  
  101.      The _g_a_m_m_a functions return HUGE_VAL when the argument is zero or a
  102.      negative integer. The -_l_m and -_l_m_x versions also set _e_r_r_n_o to EDOM.
  103.      When the correct value would overflow, the _g_a_m_m_a functions return
  104.      HUGE_VAL. The -_l_m and -_l_m_x versions also set _e_r_r_n_o to ERANGE.
  105.  
  106.      See matherr(3M) for a description of error handling for -_l_m_x functions.
  107.  
  108. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  109.      math(3M), matherr(3M)
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.